FROM registry.cn-hangzhou.aliyuncs.com/xiaoyilin/nodejs:22.18.0 AS builder
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
apt-get -y update && apt-get -y install git && \
mkdir -p /usr/local/SvelteApp && \
git clone https://gitee.com/yilinxiao/svelte-app.git /usr/local/SvelteApp
FROM registry.cn-hangzhou.aliyuncs.com/xiaoyilin/nodejs:22.18.0
LABEL author=xiaoyilin
LABEL email=406735078@qq.com
ENV TZ=Asia/Shanghai
COPY --from=builder /usr/local/SvelteApp /usr/local/SvelteApp
WORKDIR /usr/local/SvelteApp
RUN npm i -g pnpm && pnpm install
CMD ["pnpm", "run", "dev"]

# 应用程序的每个页面都是一个Svelte组件
# 项目src/routes目录放页面
# src目录包含项目的核心内容。除了src/routes和src/app.html之外的所有内容都是可选。
# 默认当用户访问网站时，SvelteKit将使用服务器端渲染(SSR)渲染第一个页面，并使用客户端渲染(CSR)渲染后续页面。
# 单页应用程序(SPA)仅使用客户端渲染(CSR)
# https://svelte.dev/docs/kit/creating-a-project
# https://svelte.dev/docs/kit/project-structure
# https://svelte.dev/docs/kit/routing
# npm install -g pnpm@latest-10
# npx sv create /usr/local/SvelteApp --template minimal --types ts
# cd /usr/local/SvelteApp
# pnpm install
# pnpm run dev
# git init && git add -A && git commit -m "Initial commit"
# git remote add origin https://gitee.com/yilinxiao/svelte-app.git
# git push -u origin "master"
# docker build -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/svelte:20250409 .
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/svelte:20250409